/*
 * Copyright (c) 2008 Anshuman Manur <anshuman.manur@gmail.com>,
 * Lavanya Shastri <lavanya.shastri@gmail.com>
 * 
 * This file is part of Andronova.
 * 
 * Andronova is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 of the License, or
 * (at your option) any later version.
 * 
 * Andronova is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *  
 * You should have received a copy of the GNU General Public License
 * along with Andronova.  If not, see <http://www.gnu.org/licenses/>.
 * 
 */

package com.googlecode.andronova;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.Menu.Item;
import android.widget.TextView;


public class Help extends Activity {

	public static int CALLING_ACTIVITY;
	
	public static final int LIBRARY = 1;
	public static final int PLAYSCREEN = 2;
	public static final int PLAYLIST_EDITOR = 3;
	public static final int TAG_EDITOR = 5;
	
	private static final String HELP_LIBRARY = 
		"The Library aims to organise your music files by reading information " +
		"about them stored within the files, called ID3 tags and " +
		"sorting them accordingly." +
		"\nThe files are sorted as following\n" +
		"* \"All\" leads to a list of all songs in the library\n" +
		"* \"Artist\" leads to a list of all artists in the library\n" +
		"* \"Album\" leads to a list of all artists in the library\n" +
		"* \"Genre\" leads to a list of all the genres in the library\n" +
		"* \"Playlist\" leads to the Editor which helps you create custom " +
		"playlists\n" +
		"Further, selecting an artist in the artist screen will list all the " +
		"albums by that artist, and clicking an album will lead to all the songs " +
		"in that album.\n" +
		"To go back to a previous screen, click on the left DPAD key.\n\n" +
		"MENU\n\n" +
		"Set Path - opens up an Editable text box which lets you choose where " +
		"to look for music files on filesystem\n\n" +
		"Configure - builds up the library by reading all the mp3 files " +
		"in the directory tree of the path entered in Set Path.\n\n" +
		"Exit - finishes this activity to take you to the activity " +
		"which you came from. (Same as hitting the back button)\n\n" +
		"Playlist - takes you to the playlist editor window.\n\n" +
		"Tag Editor - enables you to edit the ID3 tags of your mp3 files.\n\n" +
		"Help - leads you here.";
	
	private static final String HELP_PLAYSCREEN =
		"The Play Screen is the heart of the music player where you control " +
		"playback and also navigate to and from other activities.\n\n" +
		"MENU\n\n" +
		"Library - takes you to the library where you can select a song for " +
		"playback.\n\n" +
		"Playlist - takes you to the playlist editor which enables you to create " +
		"and manage custom playlists.\n\n" +
		"Lyrics - fetches lyrics of the " +
		"currently playing song and displays it.\n\n" +
		"Tag Editor - enables you to edit the ID3 tags of your mp3 files.";
	
	private static final String HELP_PLAYLIST_EDITOR =
		"The Playlist Editor activity lets you create and manage custom " +
		"playlists from the library.\n\n" +
		"MENU\n\n" +
		"Mutate - contains options to add, remove and move songs (within " +
		"the playlist) in addition to clearing all songs from the playist.\n" +
		"*To remove songs from the playlist, select the remove option from the" +
		"mutate submenu. Once in remove mode, clicking on a song will" +
		"delete the song from the playlist. Selecting" +
		"\"Done\" from the menu exits to normal mode.\n" +
		"*To move songs around within the playlist, select move mode in the" +
		"mutate menu. Once in move mode, clicking on a song will select the" +
		"song as the one to be moved (make sure to click on it with the" +
		"center DPAD key instead of using touchscreen). The up and down" +
		"keys then move the song up and down, respectively, within the " +
		"playlist. Selecting \"Done\" from the menu exit to normal mode." +
		"" +
		"Tag Editor - enables you to edit the ID3 tags of your mp3 files.\n\n" +
		"Library - takes you to the library where you can select a song for " +
		"playback.";
	
	private static final String HELP_TAG_EDITOR = 
		"";
	
	@Override
	protected void onCreate(Bundle icicle) {
		super.onCreate(icicle);
		setContentView(R.layout.helpscreen);
		setTitle("HELP!");
		
		TextView tv = (TextView) findViewById(R.id.help_main_tv);
		
		switch(CALLING_ACTIVITY) {
		case LIBRARY:
			tv.setText(HELP_LIBRARY);
			break;
			
		case PLAYSCREEN:
			tv.setText(HELP_PLAYSCREEN);
			break;
			
		case PLAYLIST_EDITOR:
			tv.setText(HELP_PLAYLIST_EDITOR);
			break;
			
		case TAG_EDITOR:
			tv.setText(HELP_TAG_EDITOR);
			break;
			
		default:
			finish();
			break;
		}		
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		super.onCreateOptionsMenu(menu);
		
		menu.add(0, 0, "Done", R.drawable.andro_done);
		
		return true;
	}

	@Override
	public boolean onOptionsItemSelected(Item item) {
		super.onOptionsItemSelected(item);
		
		switch(item.getId()) {
		case 0:
			finish();
			return true;
			
		default:
			return false;
		}		
	}
	
}
